package baidu.com;

import java.util.Random;

public class Student {
    public String name;
    public String sex;
    public int age;
    private static int score;
    private static String Room;
    //public  int score;

    public Student(){
        System.out.println("1");
    }

    public Student(String name,String sex,int age){
        this.name=name;
        this.sex=sex;
        this.age=age;
    }

    @Override
    public String toString() {
        return  "name='" + name + '\'' +
                ", sex='" + sex + '\'' +
                ", age=" + age;
    }

    //静态代码块优先运行，其次是构造代码块
    //如果有多个静态代码块，运行顺序从上到下
    /*static {
        score = 300;
        System.out.println("3");
    }
    static {
        Room="402";
        System.out.println("4");
    }
    //代码块优先运行，
    {
        this.name="小明";
        this.sex = "男";
        this.age = 77;
        System.out.println("2");
    }*/



    /*public void setStudent(String name, String sex, int age) {
        this.name = name;
        this.sex = sex;
        this.age = age;
    }*/

    /*public static int getScore() {
        return score;
    }*/

    /*public static int getScore(){  //在获取静态类的时候，需要在方法中也添加static
        return score;
    }

    public void setScore(int score){
        this.score = score;
    }

    public String getName() {
        return name;
    }

    public String getSex() {
        return sex;
    }

   *//* public String getSex(){
        return sex;
    }
    public void setSex(String sex){
        this.sex = sex;
    }*//*

    public void setName(String name) {
        this.name = name;
    }

    public void setSex(String sex) {
        this.sex = sex;
    }

    public Student(String name, String sex, int age) {
        this.name = name;
        this.sex = sex;
        this.age = age;
    }*/

    public void printf(){
        System.out.println("姓名："+name+" 性别："+sex+" 年龄："+age+" 课程成绩："+score);
    }

}
